<template>
	<div class="allcontainer">
		<div class="h2">签到情况</div>
		<div class="table bg-white" style="padding-top: 20px;">
			<el-table :data="data" v-loading="loading" :max-height="tableHeight" highlight-current-row style="width: 100%;">
				<el-table-column prop="TypeName" label="签到类型" min-width="100" align="center"></el-table-column>
				<el-table-column prop="AddTime" label="签到时间" min-width="260" align="center">
					<template slot-scope="scope">
						{{ scope.row.SignTime }} 
					</template>
				</el-table-column>
				<el-table-column prop="IsSign" label="是否签到" min-width="120" align="center">
					<template slot-scope="scope">
						<a-tag @click="setSign(scope.row)" style="cursor: pointer;" :color="scope.row.IsSign ? 'blue' : 'red'">{{ scope.row.IsSign ? '已签到' : '未签到' }}</a-tag>
					</template>
				</el-table-column>
			</el-table>
		</div>
	</div>
</template>

<script>
import Func from '@/utils/func';
import { UserActivityMemberDoGetSignList,UserActivityMemberDoSign } from '@/api/follow';
const data = [];
export default {
	components: {
	},
	data() {
		return {
			data,
			form: this.$form.createForm(this, {
				name: 'advanced_search'
			}),
			loading: false,
			tableHeight: parseFloat(window.innerHeight - 160),
		};
	},
	computed: {},
	created() {
		this.getList();
	},
	mounted() {},
	methods: {
		async getList() {
			this.loading = true;
			let data = {};
			data.activityMemberID = this.$route.query.ID
			let res = await UserActivityMemberDoGetSignList(data);
			this.loading = false;
			this.data = res.data.data;
		},
		async setSign(text){
			if(text.IsSign || this.$route.query.State==5){
				return false
			}
			let that = this;
			this.$confirm({
				title: '提示',
				content: `您确定要给该成员签到吗？`,
				okText: '确认',
				cancelText: '取消',
				async onOk() {
					let data = {};
					data.activityMemberID = that.$route.query.ID
					data.activitySignID = text.ID
					let res = await UserActivityMemberDoSign(data);
					if(res.data.code==0){
						that.$message.success(res.data.msg)
						that.getList()
					}else{
						that.$message.error(res.data.msg)
					}
				}
			});
		},
		closeFun(data) {}
	}
};
</script>

